package com.thon.entity.user;

// Generated 2013-9-23 19:12:56 by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Columns;
import org.hibernate.type.IntegerType;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.thon.commons.utils.ImageUrl;
import com.thon.entity.project.Project;
import com.thon.entity.util.IdEntity;

/**
 * MeInstitution generated by hbm2java
 */
@Entity
@Table(name = "institutions")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Institution extends IdEntity{

	private static final long serialVersionUID = 4153175820803979787L;
	private User user;
	private String name;
	private String description;
	private Integer provinceId;
	private Integer cityId;
	private Integer districtId;
	private String address;
	private String applicantName;
	private String applicantPhone;
	private String applicantTelephone;
	private String applicantEmail;
	private String applicantPost;
	private Byte status;
	private List<Project> projects;
	private Integer supportNum;
	private Integer verifyDoc_1;
	private Integer verifyDoc_2;
	private Integer verifyAuth;
	private String identityCode;
	private Date createdDate;
	private Integer verifyIdCard1;
	private Integer verifyIdCard2;
	private String verifyIdCard1Url;
	private String verifyIdCard2Url;
	private String verifyDocUrl_1;
	private String verifyDocUrl_2;
	private String verifyAuthUrl;
	private Integer startNum;
	


	@Transient
	public Integer getStartNum() {
		return this.startNum;
	}

	public void setStartNum(Integer startNum) {
		this.startNum = startNum;
	}

	public Institution() {
	}

	@OneToOne(cascade = CascadeType.MERGE)
	@JoinColumn(name = "user_id", nullable = false)
	@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getProvinceId() {
		return this.provinceId;
	}

	public void setProvinceId(Integer provinceId) {
		this.provinceId = provinceId;
	}

	public Integer getCityId() {
		return this.cityId;
	}

	public void setCityId(Integer cityId) {
		this.cityId = cityId;
	}

	public Integer getDistrictId() {
		return this.districtId;
	}

	public void setDistrictId(Integer districtId) {
		this.districtId = districtId;
	}

	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getApplicantName() {
		return this.applicantName;
	}

	public void setApplicantName(String applicantName) {
		this.applicantName = applicantName;
	}

	public String getApplicantPhone() {
		return this.applicantPhone;
	}

	public void setApplicantPhone(String applicantPhone) {
		this.applicantPhone = applicantPhone;
	}

	public String getApplicantTelephone() {
		return this.applicantTelephone;
	}

	public void setApplicantTelephone(String applicantTelephone) {
		this.applicantTelephone = applicantTelephone;
	}

	public String getApplicantEmail() {
		return this.applicantEmail;
	}

	public void setApplicantEmail(String applicantEmail) {
		this.applicantEmail = applicantEmail;
	}

	public Byte getStatus() {
		return this.status;
	}

	public void setStatus(Byte status) {
		this.status = status;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "institution")
	@JsonIgnore
	public List<Project> getProjects() {
		return this.projects;
	}

	public void setProjects(List<Project> projects) {
		this.projects = projects;
	}
	
	@Transient
	//@JsonIgnore
	public Integer getSupportNum() {
		return supportNum;
	}

	@JsonProperty
	public void setSupportNum(Integer supportNum) {
		this.supportNum = supportNum;
	}

	public Integer getVerifyAuth() { 
		return verifyAuth;
	}

	public void setVerifyAuth(Integer verifyAuth) {
		this.verifyAuth = verifyAuth;
	}

	public String getIdentityCode() {
		return identityCode;
	}

	public void setIdentityCode(String identityCode) {
		this.identityCode = identityCode;
	}

	public String getApplicantPost() {
		return applicantPost;
	}

	public void setApplicantPost(String applicantPost) {
		this.applicantPost = applicantPost;
	}
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCreatedDate() {
		return this.createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
	
	@Transient
	public String getVerifyDocUrl_1() {
		return ImageUrl.format(verifyDoc_1);
	}
	
	@Transient
	public String getVerifyDocUrl_2() {
		return ImageUrl.format(verifyDoc_2);
	}
	
	@Transient
	public String getVerifyAuthUrl() {
		return ImageUrl.format(verifyAuth);
	}
	
	@Transient
	public String getVerifyIdCard1Url() {
		return ImageUrl.format(verifyIdCard1);
	}
	
	@Transient
	public String getVerifyIdCard2Url() {
		return ImageUrl.format(verifyIdCard2);
	}
	@Column(name = "front_photo")
	public Integer getVerifyIdCard1() {
		return this.verifyIdCard1;
	}

	public void setVerifyIdCard1(Integer verifyIdCard1) {
		this.verifyIdCard1 = verifyIdCard1;
	}
	@Column(name = "back_photo")
	public Integer getVerifyIdCard2() {
		return this.verifyIdCard2;
	}

	public void setVerifyIdCard2(Integer verifyIdCard2) {
		this.verifyIdCard2 = verifyIdCard2;
	}

	public Integer getVerifyDoc_1() {
		return verifyDoc_1;
	}

	public void setVerifyDoc_1(Integer verifyDoc_1) {
		this.verifyDoc_1 = verifyDoc_1;
	}

	public Integer getVerifyDoc_2() {
		return verifyDoc_2;
	}

	public void setVerifyDoc_2(Integer verifyDoc_2) {
		this.verifyDoc_2 = verifyDoc_2;
	}
}
